package Event;

import org.w3c.dom.Text;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MyJFrame extends JFrame {
    private MyJText myJText = new MyJText("姓名",20,80,this);

    public MyJFrame(){
        this.setLayout(null);

        MyButton button = new MyButton("添加",200,80,this);


        button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                System.out.println("****");

                System.out.println("你输入的"+myJText.getText());
            }
        });

//        MyButton button1 = new MyButton("修改",200,20,this);
//        button1.addActionListener(new MyEvent());

        this.setSize(500,600);
        this.setVisible(true);
        this.setDefaultCloseOperation(3);
        this.setLocationRelativeTo(null);
    }

    public static void main(String[] args) {
        new MyJFrame();
    }
}
